#ifndef KERNEL_HAL_x86_HARDWARE_H
#define KERNEL_HAL_x86_HARDWARE_H

#include <Mint/Types.h>
#include "Hal/IHardware.h"
#include "Hal/ITaskContext.h"
#include "Hal/x86/CPU.h"
#include "Interfaces/ITextOutput.h"

namespace x86
{
	class TaskContext : public ITaskContext
	{
	public:
		Registers fRegisters;
	};

	class Hardware : public IHardware
	{
	public:
		virtual Result Initialize( void );
		virtual void Lock( void );
		virtual void Unlock( void );
		virtual void AddInterruptHandler( int interrupt, InterruptHandler handler );
		virtual ITaskContext * CreateContext( void * stackPointer, Size stackSize, TaskEntry entry, void * param );
		virtual ITaskContext * CreateEmptyContext( void );
		virtual void DisposeContext( ITaskContext * context );
		virtual void YieldContext( ITaskContext * context );
		virtual void SwitchContext( ITaskContext * oldContext, ITaskContext * currentContext, ITaskContext * newContext );
		virtual void DumpContext( ITaskContext * context, ITextOutput * output );
		virtual void DumpCurrentContext( ITextOutput * output );

	private:
		int32 lockCount;
		TaskContext * currentContext;
	};
}

#endif // KERNEL_HAL_HARDWARE_H
